package com.ymt.fmd.platform.formdesigner.parser;

import javax.script.ScriptException;

import com.alibaba.fastjson.JSONObject;
import com.ymt.fmd.appboot.prop.FmdProperties;

public interface Parser {

	/**
	 * init the parser before use
	 */
	public void init(FmdProperties fmdProperties, String realPath, String skin, String lang, String parserJsName) throws Exception;
	
	/**
	 * parse modules json to html
	 * @parma formtype form type
	 * @param env environment variables
	 * @param settings
	 * @return
	 */
	public StringBuilder parseForm(String formtype, String env, String settings) throws Exception;
	
	/**
	 * get form js parser config by formtype
	 * @param formtype
	 * @return
	 * @throws ScriptException
	 */
	public JSONObject getFormJsParserConfig(String formtype) throws ScriptException;
	
	/**
	 * parse modules json to html
	 * @param moduleList
	 * @param props
	 * @return
	 */
	public JSONObject parseModules(String moduleList, String props, String models) throws Exception;
	
	/**
	 * convert form config to readonly
	 * @param formdata
	 * @return
	 */
	public String toRoVersion(String formdata);
}
